package com.dingli.shop.controller;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class LoginController {

    @Autowired
    private RestTemplate restTemplate;

    private static final String REST_URL_PREFIX = "http://localhost:8080";

    @RequestMapping("/consumer/login")
    //@HystrixCommand(fallbackMethod = "hiError")
    public String login() {
        return restTemplate.getForObject(REST_URL_PREFIX+"/login",String.class);
    }

  /*  public String hiError() {

        return "Provider-8888 is stop";
    }*/
}
